using msJ
The mzXML are storred in a folder. We set the current directory to this folder.
cd("/Volumes/LACIE/DESIRS_nov_2015/Mode_negatif/BPTI_4.5_7.5eV/")
The readdir() function lists the files and directories and returns a vector of strings.
readdir()
Using the filter function, the list of files can be limited to those containg the .mzXML
files = filter(x->occursin(".mzXML",x), readdir())
We can look into the files using the info function
info(files[1])
s = load(files[12]);
a = average(s, msJ.Precursor(929))
c = centroid(a, method=msJ.TBPD(:gauss, 1000., 0.05))
#c = centroid(a, method=msJ.SNRA(0.07, 100))
length(c.mz)
using Plots
plotly()
plot(a)
plot(a, method = :absolute)
scatter!(c, method = :absolute)
plotlyjs()
plot(a, method = :absolute)
scatter!(c, method = :absolute)
We will loop over the file list
for f in files
We will use the same data set as in Example 1
using HTTP
data = download("https://raw.githubusercontent.com/ajgiuliani/msJ.jl/master/test/test.mzXML",
"~/Downloads/test.mzXML") ;
Now, using the info function of the msJpackage, we will see what is inside the file
info(data)
s = load(data) ;
Getting chromatograms is straightforward using the chromatogram method.
We load the entiere chromatogram like this:
full_TIC = chromatogram(s)
We may also filter the data to first MS level:
MS1_TIC = chromatogram(s, msJ.Level(1))
Or we may get only the mass spectrometry data which have been aquirred under CID conditions:
CID_TIC = chromatogram(s, msJ.Activation_Method("CID"))
We can also extract the chromatogram for a specific precursor ion:
mz902_TIC = chromatogram(s, msJ.Precursor(902.33))
Let plot the chromatograms, using theGR backend:
using Plots
gr()
A recipe has also been defined for chromatogram data.
gr()
p1 = plot(full_TIC, label = "full tic")
p2 = plot(MS1_TIC, label = " MS1_TIC")
p3 = plot(CID_TIC, label = "CID_TIC")
p4 = plot(mz902_TIC, label = "mz902_TIC")
p = plot(p1, p2, p3, p4, layout = (4,1), size = (500,500))
Plots made using GR() may be saved to a file:
savefig(p, "~/Downloads/temp.png")
Average mass spectra may be obtained using the proper msfilter functions:
ms1 = msJ.average(s, msJ.Level(1)) # MS1 scans
ms2_CID = msJ.average(s, msJ.Activation_Method("CID")) # CID scans
ms2_PQD = msJ.average(s, msJ.Activation_Method("PQD")) # PQD scans
ms2_1255 = msJ.average(s, msJ.Precursor(1255.5)); # Precursor m/z = 1255.5 scans
Mass spectra may be plotted the same way as chromatograms:
plotly()
p5 = plot(ms1, label = "MS", color = :blue)
p6 = plot(ms2_CID, label = "CID", color = :green)
p7 = plot(ms2_PQD, label = "PQD", color = :purple)
p8 = plot(ms2_1255, label = "mz 1255", color = :orange)
plot(p5, p6, p7, p8, layout = (4,1), size = (800,600))